#include "Student.h"
#include "Teacher.h"
#include<stdio.h>
#include<string.h>

bool IsNameEqual(void *p1, void *p2)
{
    Stu *s= (Stu*)p1;
    const char *str= (const char*)p2;
    return strcmp(s->Name,str)==0;
}

bool IsIdEqual(void *p1, void *p2)
{
    Stu *s=(Stu *)p1;
    int *id= (int *)p2;
    return s->id== *id;
}

bool IsIdBigger(void *p1, void *p2)
{
    Stu *s=(Stu *)p1;
    int *id= (int *)p2;
    return s->id>= *id;
}

bool IsNameContains(void *p1, void *p2)
{
    Stu *s= (Stu*)p1;
    const char *str= (const char*)p2;
    if(strstr((const char *)(s->Name),str))
    return true;
    else return false;
}

int main()
{
    // Stu s;
    // InitStu(&s,1,"zhangsan");
    // PrintStu(&s);
    // return 0;

    Teach t;
    InitTeacher(&t,1,"zhangsan");
    // PrintTeach(&t);

    addStudent(&t,1,"王五");
    addStudent(&t,2,"赵六");
    addStudent(&t,3,"As");
    addStudent(&t,2,"李六");
    addStudent(&t,4,"王五");
    addStudent(&t,1,"c六");

    int id=2;
    // RemoveStudent(&t,&id,IsIdEqual);
    // RemoveStuByname(&t,"李六");
    Stu *s= FindStudent(&t,"李",IsNameContains);
    if(s)
    PrintTeach(&t);

    return 0;
}